class Solution:
    def sortColors(self, nums) -> None:
        """
        Do not return anything, modify nums in-place instead.
        """
        i, j = 0, len(nums) - 1
        try:
            while True:
                if nums[i] != 0:
                    index = nums.index(0, i)
                    nums[i], nums[index] = nums[index], nums[i]
                i += 1
        except:
            pass
        try:
            while True:
                if nums[j] != 2:
                    index = nums.index(2, 0, j)
                    nums[j], nums[index] = nums[index], nums[j]
                j -= 1
        except:
            pass


a = Solution()
b = [2, 0, 2, 1, 1, 0]
a.sortColors(b)
print(b)
b = [1, 0, 1, 1, 1, 0]
a.sortColors(b)
print(b)
b = [2, 2, 2, 1, 1, 2]
a.sortColors(b)
print(b)


